Title Banner

Previous Book Contents Book Index Next

Inside Macintosh: QuickDraw GX Printing /
Chapter 3 - Page Formatting and Dialog Box Customization / Customizing QuickDraw GX Dialog Boxes


Setting Up Dialog Box Resources

Figure 3-19 shows the panel that is loaded in Listing 3-22. Listing 3-23 through Listing 3-27 show the resources required to add this panel.

Figure 3-19 A panel added to the Custom Page Setup dialog box

Listing 3-23 shows the panel resource, which is added to the dialog box by the MySetUpByPagePanel function shown in Listing 3-22.

Listing 3-23 Sample panel resource

#define r_dayPopUpCtl   150   /* ID of the panel's pop-up CNTL */
#define r_dayPopUpMenu  160   /* ID of the panel's pop-up menu */

/* Description of panel added to dialog box. */

resource gxPrintPanelType (r_MyFormatPanelResID, sysheap,
                           purgeable)
{
   "My override", smRoman, r_MyFormatPanelResID,/* Icon ResID */
                           r_MyFormatPanelResID /* Panel ResID */
};
Listing 3-24 shows the item list resource, 'DITL', that defines the contents of the panel.

Listing 3-24 Sample item list resource

resource 'DITL' (r_MyFormatPanelResID, sysheap, purgeable) {
   {
      {42, 120, 60, 166},
      RadioButton {
         enabled,
         "Off"      },
      {42, 175, 60, 220},
      RadioButton {
         enabled,
         "On"      },
      {14, 27, 35, 323},      /* represents the days of the week 
                                 pop-up menu */
      Control {
         enabled,
         r_dayPopUpCtl
      }
   }
};
Note
When you design your 'DITL' resources, note that (0.0, 0.0) for a panel is at the top-left corner of the panel and not at the top-left corner of the dialog box. When you want to locate the position of the cursor within a panel, you use the GXGetJobPanelDimensions function to obtain the dimensions of a panel.
Listing 3-25 shows the control resource, 'CNTL', that defines the pop-up menu control.

Listing 3-25 Sample 'CNTL' resource

resource 'CNTL' (r_dayPopUpCtl, sysheap, purgeable)
{
   {72, 4, 93, 300},
   popupTitleLeftJust,     /* menu's title is left justified */
   visible,                /* show it */
   140,                    /* width of the menu title */
   r_dayPopUpMenu,         /* resource ID of the associated 
                              menu */
   popupMenuCDEFproc + popupFixedWidth,   /* type of pop-up 
                                             menu */
   0,                                     /* reference constant */
   "Best Day of the Week:"                /* control's title */
};
Listing 3-26 shows the extended item list resource that specifies how to process the items in the panel. For more information about extended item list resources, see "Automating Panel Events" beginning on page 3-25.

Listing 3-26 Sample extended item list resource

#define kCreator                 'Ex#9'
...
#define kMyKindaCollectionType   kCreator
#define kMyKindaCollectionTagID  gxPrintingTagID +1
...
resource gxExtendedDITLType (r_MyFormatPanelResID,
                                              sysheap, purgeable)
{
   {
      RadioButtons {kMyKindaCollectionType,
                   kMyKindaCollectionTagID, 0, {1,2}},
      PopUp  {kMyKindaCollectionType, 
                     kMyKindaCollectionTagID, 2, 3}
   };
};
This extended item list resource handles two items, a pair of radio buttons, corresponding to the first two items in the 'DITL' resource, and a pop-up menu. All of these items are stored in one collection item, which is identified by the kMyKindaCollectionType collection tag and the kMyKindaCollectionTagID item ID. The application creator is used for the collection type to distinguish it from collection items provided by QuickDraw GX. The collection item ID is simply derived from a base; in this case, gxPrintingTagID.

The status of the radio buttons occupy the first 2 bytes of the collection item (from offset 0). These bytes specify the status of items 1 and 2. The status of the pop-up menu is at offset 2. It specifies the status of item 3.

Listing 3-27 shows the 'MENU' resource, which specifies the entries in the pop-up menu. Note that the default entry is specified in the collection item.

Listing 3-27 Sample 'MENU' resource

resource 'MENU' (r_dayPopUpMenu, sysheap, purgeable) {
   r_dayPopUpMenu,
   textMenuProc,
   allEnabled,
   enabled,
   "",
   {
      "Sunday",      noIcon, noKey, noMark, plain,
      "Monday",      noIcon, noKey, noMark, plain,
      "Tuesday",     noIcon, noKey, noMark, plain,
      "Wednesday",   noIcon, noKey, noMark, plain,
      "Thursday",    noIcon, noKey, noMark, plain,
      "Friday",      noIcon, noKey, noMark, plain,
      "Saturday",    noIcon, noKey, noMark, plain
   }
};

Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996




Navigation graphic, see text links

Main | Page One | What's New | Apple Computer, Inc. | Find It | Contact Us | Help